#@adminLayout()

#define main()
<div class="jfa-header-box" id="jfa-header-box">
    <div class="jfa-crumbs" id="jfa-crumbs">
        媒体管理
    </div>
    <div class="jfa-search-box"></div>
    #include("/_view/_admin/common/_header_right.html")
</div>

### 内容区域
<div class="jfa-content-box" id="jfa-content-box">
    <div class="jfa-content" id="jfa-content">

        <div class="jfa-toolbar">
            <a class="btn btn-primary btn-sm" href="/admin/media/add">
                <i class="fa fa-plus"></i>
                新增媒体
            </a>
        </div>

        <div class="jfa-table-box margin-top-30">
            <table class="table table-bordered table-hover margin-bottom-10">
                <thead>
                <tr>
                    <th>id</th>
                    <th>标题</th>
                    <th>创建时间</th>
                    <th>锁定</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                #for(x : medias.getList())
                <tr>
                    <th scope="row">#(x.id)</th>
                    <td>
                        <a href="/media/#(x.id)" target="_blank">#(x.mediaName)</a>
                    </td>
                    <td>#date(x.createDate)</td>

                    <td>
                        #set(locked = x.openTake > 0)
                        <input data-id="#(x.id)"
                               #if(locked) checked #end

                               type="checkbox" class="mgc-switch mgc-tiny">
                    </td>

                    <td class="jfa-operation-button">
                        <a href="/admin/media/edit?id=#(x.id)&p=#(medias.pageNumber)">
                            <i class="fa fa-pencil" title="修改"></i>
                        </a>

                        <a data-delete
                           data-title="#escape(x.title)"
                           data-action="/admin/media/delete?id=#(x.id)">
                            <i class="fa fa-trash" title="删除"></i>
                        </a>

                        <a data-pjax href="/admin/media/getReplyList?mediaId=#(x.id)">
                            <i class="fa fa-reply" title="回复管理"></i>
                        </a>

                    </td>
                </tr>
                #end
                </tbody>
            </table>

            <div>
                #@adminPaginate(medias.pageNumber, medias.totalPage, "/admin/media?p=")
            </div>
        </div>
    </div><!-- END OF jfa-content -->
</div><!-- END OF jfa-content-box -->

<style type="text/css">
</style>
<script type="text/javascript">
    $(document).ready(function() {
        initMagicInput(prepareAction);
    });

    function prepareAction($this, state) {
        return {
            url: state ? "/admin/media/lock" : "/admin/media/unlock",
            data : {
                id: $this.attr("data-id")
            }
        }
    }

</script>
#end




